Skip to content

feat(resolver): add versionmap-git source resolver#1197

Open
jskladan wants to merge 1 commit into
python-wheel-build:mainfrom
jskladan:AIPCC-17610
Open

feat(resolver): add versionmap-git source resolver#1197
jskladan wants to merge 1 commit into
python-wheel-build:mainfrom
jskladan:AIPCC-17610

Conversation

@jskladan

@jskladan jskladan commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Add VersionMapGitResolver config model for the versionmap-git provider from the new-resolver-config proposal. Maps version numbers to git refs (commit SHAs or ref paths) with a separate clone_url, replacing the need for handwritten Python plugins.

  • Add VersionMapGitResolver pydantic model with clone_url, build_sdist, and versionmap fields
  • Register in SourceResolver discriminated union
  • Add to config reference docs
  • Add tests for config parsing, provider output, and validation

Closes: #1180

@jskladan jskladan requested a review from a team as a code owner June 17, 2026 11:57
@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@jskladan, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 38 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5ed5b5db-361b-424a-b6fc-f9ec8c965f1b

📥 Commits

Reviewing files that changed from the base of the PR and between eb5979c and 32a4fc1.

📒 Files selected for processing (5)
  • docs/reference/config-reference.rst
  • src/fromager/packagesettings/__init__.py
  • src/fromager/packagesettings/_resolver.py
  • tests/test_packagesettings_resolver.py
  • tests/test_resolver.py
📝 Walkthrough

Walkthrough

A new VersionMapGitResolver class is added to src/fromager/packagesettings/_resolver.py. It accepts a clone_url, a versionmap of version strings to git refs, and an optional build_sdist mode. Its resolver_provider method constructs a {version: git+<clone_url>@<ref>} mapping, wraps it in a VersionMap, and returns a VersionMapProvider with constraints and the requested requirement type. The new class is added to the SourceResolver discriminated union under provider: "versionmap-git", exported from packagesettings, documented in the config reference, and covered by new resolver tests.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the new versionmap-git source resolver.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The description accurately matches the new VersionMapGitResolver model, docs, and tests added in this changeset.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mergify mergify Bot added the ci label Jun 17, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
docs/reference/config-reference.rst (1)

44-45: ⚡ Quick win

Add a versionadded directive for this new user-facing resolver entry.

Line 44 introduces a new config model in user-facing docs, but there’s no explicit version marker in this section. Please add .. versionadded:: next to this entry for release traceability.

Suggested patch
 .. autopydantic_model:: VersionMapGitResolver
+
+   .. versionadded:: 0.79.0

As per coding guidelines: "Use Sphinx versionadded, versionremoved, versionchanged directives for user-facing changes".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/reference/config-reference.rst` around lines 44 - 45, The
VersionMapGitResolver autopydantic_model directive in the config reference
documentation is missing a versionadded directive to track when this new
user-facing resolver was introduced. Add a `.. versionadded::` directive before
the `.. autopydantic_model:: VersionMapGitResolver` line, specifying the
appropriate version number where this resolver was first available, to comply
with the documentation guidelines for user-facing changes.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/fromager/packagesettings/_resolver.py`:
- Around line 517-522: The validate_clone_url method in the Resolver class
currently accepts URLs with only a host and no repository path because Pydantic
v2 normalizes the path to "/" which is truthy. Add an additional validation
check after the existing path validation to explicitly reject URLs where the
path is only "/" or is root-only. This will prevent invalid git URLs that lack
an actual repository path from passing validation.

---

Nitpick comments:
In `@docs/reference/config-reference.rst`:
- Around line 44-45: The VersionMapGitResolver autopydantic_model directive in
the config reference documentation is missing a versionadded directive to track
when this new user-facing resolver was introduced. Add a `.. versionadded::`
directive before the `.. autopydantic_model:: VersionMapGitResolver` line,
specifying the appropriate version number where this resolver was first
available, to comply with the documentation guidelines for user-facing changes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 48b234c8-c0ab-46c3-a2e3-b4b237852236

📥 Commits

Reviewing files that changed from the base of the PR and between 1d2876b and f4d72f1.

📒 Files selected for processing (5)
  • docs/reference/config-reference.rst
  • src/fromager/packagesettings/__init__.py
  • src/fromager/packagesettings/_resolver.py
  • tests/test_packagesettings_resolver.py
  • tests/test_resolver.py

Comment thread src/fromager/packagesettings/_resolver.py
@jskladan jskladan force-pushed the AIPCC-17610 branch 2 times, most recently from 5ad9e22 to 6a33ca3 Compare June 18, 2026 07:01

@rd4398 rd4398 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have left a few comments. Also, please use the linked issue on GitHub as "closes". We should not mention anything related to downstream (AIPCC in this case).

Also, I would appreciate if @tiran and / or @LalatenduMohanty takes a look as well.

Comment thread src/fromager/packagesettings/_resolver.py Outdated
Comment thread src/fromager/packagesettings/_resolver.py
Comment thread docs/reference/config-reference.rst Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/test_packagesettings_resolver.py`:
- Around line 449-455: The current resolver test only verifies git URL rewriting
in resolver_provider and does not cover the new build_sdist contract. Update the
test coverage around resolver_provider and the build path so a versionmap-git
config with build_sdist: tarball is exercised end-to-end, then assert that the
selected sdist strategy comes from sources.build_sdist rather than only checking
VersionMapProvider.version_map. Use the existing resolver_provider, WorkContext,
and sources.build_sdist symbols to locate the behavior and make sure the
regression test fails if build_sdist is ignored downstream.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 3ffdc863-d735-4be6-8304-fbc175a59b48

📥 Commits

Reviewing files that changed from the base of the PR and between c278a43 and eb5979c.

📒 Files selected for processing (5)
  • docs/reference/config-reference.rst
  • src/fromager/packagesettings/__init__.py
  • src/fromager/packagesettings/_resolver.py
  • tests/test_packagesettings_resolver.py
  • tests/test_resolver.py
✅ Files skipped from review due to trivial changes (1)
  • docs/reference/config-reference.rst
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/fromager/packagesettings/init.py
  • src/fromager/packagesettings/_resolver.py
  • tests/test_resolver.py

Comment thread tests/test_packagesettings_resolver.py
Add `VersionMapGitResolver` config model for the `versionmap-git`
provider from the new-resolver-config proposal. Maps version numbers
to git refs (commit SHAs or ref paths) with a separate `clone_url`,
replacing the need for handwritten Python plugins.

- Add `VersionMapGitResolver` pydantic model with `clone_url`,
  `build_sdist`, and `versionmap` fields
- Register in `SourceResolver` discriminated union
- Add to config reference docs
- Add tests for config parsing, provider output, and validation

Closes: python-wheel-build#1180
Co-Authored-By: Claude <claude@anthropic.com>
Signed-off-by: Josef Skladanka <jskladan@redhat.com>
@jskladan

Copy link
Copy Markdown
Contributor Author

@rd4398 everything should be addressed. I'm also not sure what to do about the fialing coverage report though.

I ran

hatch run test:coverage erase
hatch run test:test --cov --cov-report=term-missing --cov-config=pyproject.toml -x -q

on both my branch and the current main, and the branch adds 70 statements and 4 branches (new code in the resolver), while actually reducing misses by 1. Coverage is identical at 86% on both branches.

Metric main AIPCC-17610 Delta
Total Stmts 14,087 14,157 +70
Total Miss 1,617 1,616 -1
Total Branches 2,212 2,216 +4
Partial Branches 271 270 -1
Overall Coverage 86% 86% 0%
Tests passed 800 806 +6

I don't see any coverage regression on my part, but I obviously don't have all the e3e data the CI coverage job combines for the --fail-under=60 threshold.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VersionMap values should be git refs, not full URLs

2 participants